package com.piz.model;
import static javax.persistence.GenerationType.IDENTITY;

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.web.multipart.MultipartFile;

/**
 * CusineDetails generated by hbm2java
 */
@Entity
@Table(name = "item_details")
public class ItemDetails implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 9106888743771700831L;
	
	private Long id;
	
	
	private String name;
	
	
	private String description;
	
	
	private String image;
	
	
	private MultipartFile file;
	
	
	private Long categoryId;
	
	
	private Long classificationId;
	
	
	private Long tasteId;
	
	
	private Date createdAt;
	
	
	private Date updatedAt;
	
	private List<ItemPricing> prices;
	
	private Double singlePrice;
	
	


	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "ID")
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@NotEmpty
	@Column(name = "NAME")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "DESCRIPTION")
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	
	@Column(name = "IMAGE")
	public String getImage() {
		return image;
	}

	public void setImage(String image) {
		this.image = image;
	}

	
	@Transient
	public MultipartFile getFile() {
		return file;
	}

	public void setFile(MultipartFile file) {
		this.file = file;
	}

	@NotNull
	@Column(name = "CATEGORY_ID")
	public Long getCategoryId() {
		return categoryId;
	}

	public void setCategoryId(Long categoryId) {
		this.categoryId = categoryId;
	}

	@NotNull
	@Column(name = "CLASSIFICATION_ID")
	public Long getClassificationId() {
		return classificationId;
	}

	public void setClassificationId(Long classificationId) {
		this.classificationId = classificationId;
	}

	@NotNull
	@Column(name = "TASTE_ID")
	public Long getTasteId() {
		return tasteId;
	}

	public void setTasteId(Long tasteId) {
		this.tasteId = tasteId;
	}

	@Column(name = "CREATED_AT")
	public Date getCreatedAt() {
		return createdAt;
	}

	public void setCreatedAt(Date createdAt) {
		this.createdAt = createdAt;
	}

	@Column(name = "UPDATED_AT")
	public Date getUpdatedAt() {
		return updatedAt;
	}

	public void setUpdatedAt(Date updatedAt) {
		this.updatedAt = updatedAt;
	}

	@OneToMany(cascade={CascadeType.ALL},fetch = FetchType.EAGER)
	@JoinColumn(name="ITEM_DETAILS_ID")
	public List<ItemPricing> getPrices() {
		return prices;
	}

	public void setPrices(List<ItemPricing> prices) {
		this.prices = prices;
	}

	public static long getSerialVersionUID() {
		return serialVersionUID;
	}

	@Transient
	public Double getSinglePrice() {
		return singlePrice;
	}

	public void setSinglePrice(Double singlePrice) {
		this.singlePrice = singlePrice;
	}
	
}
